# 模型类
class Book():
    '''模型类，用于封装图书信息'''

    def __init__(self, name=None, author=None, pub=None) -> None:
        self.title = name
        self.author = author
        self.press = pub

    @property
    def title(self):
        return self.__title

    @title.setter
    def title(self, name):
        self.__title = name

    @property
    def author(self):
        return self.__author

    @author.setter
    def author(self, writer):
        self.__author = writer

    @property
    def press(self):
        return self.__press

    @press.setter
    def press(self, pub):
        self.__press = pub

    def __str__(self) -> str:
        return '书名：{}\n作者：{}\n出版社：{}\n'.format(
            self.title, 
            self.author,
            self.press
        )


if __name__ == '__main__':
    book = Book()
    # 存储实例对象属性的字典
    # {'_Book__title': None, '_Book__author': None, '_Book__press': None}
    print(book.__dict__)
    print(Book.__dict__)